|
currentsens 2.2.0
|
API for configuring and manipulating Current Sens Click driver. More...
Topics | |
| Current Sens Registers Settings | |
| Settings for registers of Current Sens Click driver. | |
| Current Sens MikroBUS Map | |
| MikroBUS pin mapping of Current Sens Click driver. | |
Functions | |
| void | currentsens_cfg_setup (currentsens_cfg_t *cfg) |
| Current Sens configuration object setup function. | |
| void | currentsens_drv_interface_sel (currentsens_cfg_t *cfg, currentsens_drv_t drv_sel) |
| Current Sens driver interface setup function. | |
| err_t | currentsens_init (currentsens_t *ctx, currentsens_cfg_t *cfg) |
| Current Sens initialization function. | |
| err_t | currentsens_read_raw_adc (currentsens_t *ctx, uint16_t *raw_adc) |
| Current Sens read raw ADC value function. | |
| err_t | currentsens_read_voltage (currentsens_t *ctx, float *voltage) |
| Current Sens read voltage level function. | |
| err_t | currentsens_read_voltage_avg (currentsens_t *ctx, uint16_t num_conv, float *voltage_avg) |
| Current Sens read average voltage level function. | |
| err_t | currentsens_set_vref (currentsens_t *ctx, float vref) |
| Current Sens set vref function. | |
| err_t | currentsens_calib_offset (currentsens_t *ctx) |
| Current Sens calib offset function. | |
| err_t | currentsens_calib_resolution (currentsens_t *ctx, float calib_current) |
| Current Sens calib resolution function. | |
| err_t | currentsens_read_current (currentsens_t *ctx, float *current) |
| Current Sens read current function. | |
API for configuring and manipulating Current Sens Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| err_t currentsens_calib_offset | ( | currentsens_t * | ctx | ) |
Current Sens calib offset function.
This function calibrates the zero current offset value.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_calib_resolution | ( | currentsens_t * | ctx, |
| float | calib_current ) |
Current Sens calib resolution function.
This function calibrates the data resolution at the known load current.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [in] | calib_current | : The known load current used for calibrating data resolution. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void currentsens_cfg_setup | ( | currentsens_cfg_t * | cfg | ) |
Current Sens configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See currentsens_cfg_t object definition for detailed explanation. |
| void currentsens_drv_interface_sel | ( | currentsens_cfg_t * | cfg, |
| currentsens_drv_t | drv_sel ) |
Current Sens driver interface setup function.
This function sets a serial driver interface which will be used further in the Click driver.
| [out] | cfg | : Click configuration structure. See currentsens_cfg_t object definition for detailed explanation. |
| [in] | drv_sel | : Driver interface selection. See currentsens_drv_t object definition for detailed explanation. |
| err_t currentsens_init | ( | currentsens_t * | ctx, |
| currentsens_cfg_t * | cfg ) |
Current Sens initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See currentsens_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_read_current | ( | currentsens_t * | ctx, |
| float * | current ) |
Current Sens read current function.
This function reads the input current level [A].
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [out] | current | : Input current level [A]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_read_raw_adc | ( | currentsens_t * | ctx, |
| uint16_t * | raw_adc ) |
Current Sens read raw ADC value function.
This function reads raw ADC value.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [out] | raw_adc | : Output ADC result. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_read_voltage | ( | currentsens_t * | ctx, |
| float * | voltage ) |
Current Sens read voltage level function.
This function reads raw ADC value and converts it to proportional voltage level.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [out] | voltage | : Output voltage level [V]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_read_voltage_avg | ( | currentsens_t * | ctx, |
| uint16_t | num_conv, | ||
| float * | voltage_avg ) |
Current Sens read average voltage level function.
This function reads a desired number of ADC samples and calculates the average voltage level.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [in] | num_conv | : Number of ADC samples. |
| [out] | voltage_avg | : Average output voltage level [V]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t currentsens_set_vref | ( | currentsens_t * | ctx, |
| float | vref ) |
Current Sens set vref function.
This function sets the voltage reference for Current Sens Click driver.
| [in] | ctx | : Click context object. See currentsens_t object definition for detailed explanation. |
| [in] | vref | : Reference voltage (volts). |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.